package com.zhuss.opus.invit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.opus.invit.CreamInvitBo;
import com.zhuss.bean.bo.opus.invit.CreateInvitBo;
import com.zhuss.bean.bo.opus.invit.DeleteInvitBo;
import com.zhuss.bean.bo.opus.invit.UpdateInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.CollectInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.DelTopicInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.ForwardInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.RecommendInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.ThumbInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.TopicInvitBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.WpsException;

/**
 * invit操作service（基本操作）
 * @author zhushanshuo
 * @Date 2020-02-05 15:59
 *
 */
@Component("invitOperateService")
public class InvitOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("invitCreate")
	private Processor<Object, CreateInvitBo> invitCreate;
	
	@Autowired
	@Qualifier("invitUpdate")
	private Processor<Object, UpdateInvitBo> invitUpdate;
	
	@Autowired
	@Qualifier("invitDelete")
	private Processor<Object, DeleteInvitBo> invitDelete;
	
	@Autowired
	@Qualifier("invitThumb")
	private Processor<Object, ThumbInvitBo> invitThumb;
	
	@Autowired
	@Qualifier("invitCollect")
	private Processor<Object, CollectInvitBo> invitCollect;
	
	@Autowired
	@Qualifier("invitForward")
	private Processor<Object, ForwardInvitBo> invitForward;
	
	@Autowired
	@Qualifier("invitRecommend")
	private Processor<Object, RecommendInvitBo> invitRecommend;
	
	@Autowired
	@Qualifier("invitCream")
	private Processor<Object, CreamInvitBo> invitCream;
	
	@Autowired
	@Qualifier("invitTopic")
	private Processor<Object, TopicInvitBo> invitTopic;
	
	@Autowired
	@Qualifier("invitDelThumb")
	private Processor<Object, ThumbInvitBo> invitDelThumb;
	
	@Autowired
	@Qualifier("invitDelCollect")
	private Processor<Object, CollectInvitBo> invitDelCollect;
	
	@Autowired
	@Qualifier("invitDelForward")
	private Processor<Object, ForwardInvitBo> invitDelForward;
	
	@Autowired
	@Qualifier("invitDelTopic")
	private Processor<Object, DelTopicInvitBo> invitDelTopic;
	
	@Autowired
	@Qualifier("invitDelRecommend")
	private Processor<Object, RecommendInvitBo> invitDelRecommend;
	
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws WpsException {
		
		CreateInvitBo bo = (CreateInvitBo) param;
		
		invitCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws WpsException {
    	
		UpdateInvitBo bo = (UpdateInvitBo) param;
		
		invitUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws WpsException {
		
		DeleteInvitBo bo = (DeleteInvitBo) param;
		
		invitDelete.process(bo);
		
		return null;
	}
	
	/**
	 * 点赞
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void thumb(Object param) throws WpsException {
		
		ThumbInvitBo bo = (ThumbInvitBo) param;
		
		invitThumb.process(bo);
		
		return null;
	}
	
	/**
	 * 收藏
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void collect(Object param) throws WpsException {
		
		CollectInvitBo bo = (CollectInvitBo) param;
		
		invitCollect.process(bo);
		
		return null;
	}
	
	/**
	 * 转发
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void forward(Object param) throws WpsException {
		
		ForwardInvitBo bo = (ForwardInvitBo) param;
		
		invitForward.process(bo);
		
		return null;
	}
	
	/**
	 * 推荐
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void recommend(Object param) throws WpsException {
		
		RecommendInvitBo bo = (RecommendInvitBo) param;
		
		invitRecommend.process(bo);
		
		return null;
	}
	
	/**
	 * 评论
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void topic(Object param) throws WpsException {
		
		TopicInvitBo bo = (TopicInvitBo) param;
		
		invitTopic.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 点赞
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delThumb(Object param) throws WpsException {
		
		ThumbInvitBo bo = (ThumbInvitBo) param;
		
		invitDelThumb.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 收藏
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delCollect(Object param) throws WpsException {
		
		CollectInvitBo bo = (CollectInvitBo) param;
		
		invitDelCollect.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 转发
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delForward(Object param) throws WpsException {
		
		ForwardInvitBo bo = (ForwardInvitBo) param;
		
		invitDelForward.process(bo);
		
		return null;
	}
	
	/**
	 * 删
	 * 推荐
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delRecommend(Object param) throws WpsException {
		
		RecommendInvitBo bo = (RecommendInvitBo) param;
		
		invitDelRecommend.process(bo);
		
		return null;
	}
	
	/**
	 * 删
	 * 评论
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delTopic(Object param) throws WpsException {
		
		DelTopicInvitBo bo = (DelTopicInvitBo) param;
		
		invitDelTopic.process(bo);
		
		return null;
	}
	
	/**
	 * 优选
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void cream(Object param) throws WpsException {
		
		CreamInvitBo bo = (CreamInvitBo) param;
		
		invitCream.process(bo);
		
		return null;
	}
	
}

